//
//  AppDelegate.swift
//  构造函数
//
//  Created by Summer on 2017/11/14.
//  Copyright © 2017年 Summer. All rights reserved.
//

import UIKit

// @UIApplicationMain，程序的入口main，如果是OC的错误导致的崩溃会停在这里
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    // 反射机制的概念
    // 对于任何一个类，都能够知道这个类的所有属性和方法
    // 对于任何一个对象，都能够调用它的任意一个方法和属性
    // 这种动态获取的信息和动态调用对象的方法的功能，称为java语言的反射机制
    
    // 在OC中如何利用反射机制
    // OC中最常用的是，NSSClassFromString获得类，使用运行时获得属性和方法，kvc可以设置属性，方法可以被调用
    // 利用NSClassFromString方法，使用字符串获得类，避免类引入很多头文件
    // 利用isMemberOfClass方法，判断是否是一个类
    // 利用isKindOfClass方法，判断是否是一个类或子类
    // 利用comformsToProtocol方法，判断对象是否遵守某一个协议
    // 利用respondsToSelector方法，判断是否实现了某一个方法
    // 利用performSelector或objc_msgSend间接调用方法

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }


}

